Repository navigation
fix(xbrl): require section evidence for three current/noncurrent entries (#1438) - #2071
Merged
Merged
Conversation
OtherBorrowings, AdvancesFromFederalHomeLoanBanks and RestrictedCashAndCashEquivalents each map to one current and one noncurrent concept. With no section, get_standard_concept() took the first candidate, so BXP's unsecured term loans (FY2025 10-K 0001037540-26-000006, $797,053,000 / $798,813,000, an unclassified REIT balance sheet) became ShortTermDebt. These three now resolve only from the row's own classified section or a classified ancestor and otherwise return None; the row keeps its filed label and values, get_display_name() agrees, and lookup() still lists both candidates. No mapping data changes. _derive_section_from_parent() no longer uses an ambiguous parent's context-free first candidate. A parent that states no side passes on its nearest classified ancestor's (conflicts and cycles give none), a ...CurrentAndNoncurrent parent states no side, noncurrent spellings are matched before the current ones they contain, and a single-candidate parent outside the balance sheet role (LongTermDebtNoncurrent in a debt note) still states its side. Stitching no longer merges a restricted-cash aggregate with its current or noncurrent portion on name containment, even when a common period agrees. The GH #1685 guard is unchanged. Across the 65 committed XBRL fixture sets, 27 of 87,716 standardized rows change: 15 target rows lose a first-candidate concept, 12 children now match their classified parent (XOM deferred taxes, debt discounts under long-term debt). Design and BXP case by synfonia-llc on GH #1438. Refs #1438 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1438
Implements the scope I posted on #1438, built from synfonia-llc's design and BXP case.
What changes
OtherBorrowings,AdvancesFromFederalHomeLoanBanksandRestrictedCashAndCashEquivalentsresolve only from the row's own current/noncurrent section, or from a classified ancestor whose section matches the candidate's kind. Otherwiseget_standard_concept()returnsNoneand the row keeps its filed label and values.get_display_name()agrees, so no "Short-Term Debt" label comes back through the label path.lookup()still returns both candidates. This adds no status API, andgaap_mappings.jsonis unchanged: the rule is a three-key frozenset inreverse_index.py._derive_section_from_parent(). An ambiguous parent's context-free first candidate no longer counts as evidence. A parent that states no side passes on its nearest classified ancestor's side, found through the statement's own calculation parents; ancestors that disagree, or a cycle, give no side. A...CurrentAndNoncurrentparent states no side. Noncurrent spellings are matched before the current spellings they contain (OtherNoncurrentAssetsused to read as current).Assets/Liabilitiestotals never count as a side. A single-candidate parent outside the balance sheet role, such asLongTermDebtNoncurrentin a debt note, still gives its side.RestrictedCash,RestrictedCashAndCashEquivalents) and a current or noncurrent portion (...AtCarryingValue,...Current,...Noncurrent) never merge on name containment, even when a common-period value agrees. The [DATA] Stitched balance sheet merges any two cash-bucket lines from different filings, so cash plus short-term investments can show as cash and cash equivalents #1685 guard is unchanged and covered by a control test.Verification
Ground truth, read from the filings and checked offline against verbatim gzipped XBRL now committed under
tests/fixtures/xbrl_gz/(SHA-256 values in its README):0001037540-26-000006: the balance sheet'sus-gaap:OtherBorrowingsrow "Unsecured term loans, net" is $797,053,000 at 2025-12-31 and $798,813,000 at 2024-12-31. Its standard concept wasShortTermDebton main and is none here. The label and values are unchanged, and thestandard=Truerender shows no "Short-Term" on that line.0000950170-25-047820. In the long-term borrowings note, "Total advances with FHLB" ($27,068,000 at 2024-12-31) rolls up toLongTermDebtNoncurrentand resolvesLongTermDebt. This is the control showing that a supported classification survives. It also caught a regression in my first cut: the debt note isn't a balance sheet role, so the parent's section lookup came back empty.0000713676-26-000020(checked live, not committed): FHLB advances ($13,000,000,000) andOtherBorrowings"Other" ($2,443,000,000) underLongTermDebt"Total borrowed funds" stayLongTermDebt, the same as on main.OtherBorrowings→ noncurrent liabilities. I searched 42 filers reporting both tags at CY2024Q4, plus theLongTermDebtNoncurrent/LiabilitiesNoncurrentframe intersections for 2012–2025. Banks file unclassified balance sheets. The two-level chain is covered by the synthetic test, both sides, plus a generic-total parent, conflicting parents and a cycle.0000034088-23-000020(existing fixture): the deferred tax on PP&E ($25,607,000,000 at 2022-12-31) moves fromDeferredTaxCurrentLiabilitiestoDeferredTaxNonCurrentLiabilities, matching its own total, which was already noncurrent on main.The new regression file is
tests/issues/regression/test_issue_1438_classification_evidence.py(31 tests). On origin/main, 17 of them fail: every targeted behavior, XOM included. The 14 that pass are controls: Pathfinder, the current-liabilities chain, #1685, name-variant merges and the classified-section cases. On this branchhatch run test-fastgives 52,704 passed, 9 skipped, 1 xfailed. The offline standardization/stitching/mapping selection gives 19,382 passed. Lint is unchanged (same count as main).check-regression-provenancepasses.Two existing tests changed on purpose.
test_issue_1438_followup.pyandtest_issue_1441_industry_mappings.pyasserted the first-candidate fallback for these entries, such as(None, "LongTermDebt")for FHLB with no section. For the three require-evidence tags they now expectNonewithout a side. Every other tag keeps its assertion.Every changed fixture row
standard_conceptfor every non-abstract row of every statement role in all 65 committed XBRL fixture sets (git ls-files testsdirectories holding a schema), standardized throughxbrl.standardization.standardize_statement_data(), on origin/main vs this branch. 27 of 87,716 rows change, and every changed row is listed:LongTermDebtorLongTermDebtNoncurrent....CurrentAndNoncurrent"Liabilities"): it moves current → noncurrent because its parent maps toRetirementRelatedNonCurrentAssets. A liability candidate was picked from an asset section by_disambiguate_by_context()'s existing name fallback. I left that fallback alone as out of scope; neither side is right for a current-and-noncurrent total.attachments/aapl/20250329RestrictedCashAndCashEquivalents—statement-fidelity/0001298946-24-000052/xbrlRestrictedCashAndCashEquivalentsAssetsstatement-fidelity/0001581068-21-000012/xbrlRestrictedCashAndCashEquivalentsCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsxbrl/cato/10k_2023RestrictedCashAndCashEquivalents—xbrl/jpm/10k_2013OtherBorrowings—xbrl/jpm/10k_2013RestrictedCashAndCashEquivalents—xbrl/jpm/10k_2024RestrictedCashAndCashEquivalents—xbrl/ko/10k_2024RestrictedCashAndCashEquivalents—xbrl/ko/10k_2024RestrictedCashAndCashEquivalentsCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsxbrl/special_cases/custom_taxonomy/baRestrictedCashAndCashEquivalents—xbrl/special_cases/dimensional/koRestrictedCashAndCashEquivalents—xbrl/special_cases/dimensional/koRestrictedCashAndCashEquivalentsCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsxbrl_gz/ba/10k_2025RestrictedCashAndCashEquivalents—xbrl_gz/intu/10k_2026RestrictedCashAndCashEquivalentsCashCashEquivalentsRestrictedCashAndRestrictedCashEquivalentsxbrl_gz/intu/10k_2026RestrictedCashAndCashEquivalentsintu_FundsReceivableAndAmountsHeldForCustomersxbrl/aaplDebtInstrumentUnamortizedDiscountPremiumAndDebtIssuanceCostsNetLongTermDebtxbrl/aapl/10k_2023DebtInstrumentUnamortizedDiscountPremiumAndDebtIssuanceCostsNetLongTermDebtxbrl/msft/10k_2024DebtInstrumentUnamortizedDiscountPremiumAndDebtIssuanceCostsNetLongTermDebtxbrl/sif/10k_2025PensionAndOtherPostretirementDefinedBenefitPlansLiabilitiesCurrentAndNoncurrentDefinedBenefitPlanAmountsRecognizedInBalanceSheetxbrl/xom/10k_2023DeferredTaxLiabilitiesPropertyPlantAndEquipmentDeferredIncomeTaxLiabilitiesxbrl/xom/10k_2023DeferredTaxLiabilitiesOtherDeferredIncomeTaxLiabilitiesxbrl/xom/10k_2023DeferredTaxAssetsOperatingLossCarryforwardsDeferredTaxAssetsGrossxbrl/xom/10k_2023DeferredTaxAssetsOtherDeferredTaxAssetsGrossxbrl/zbh/10k_2018DebtInstrumentUnamortizedDiscountPremiumAndDebtIssuanceCostsNetLongTermDebtNoncurrentxbrl_gz/intu/10k_2026DebtInstrumentUnamortizedDiscountPremiumAndDebtIssuanceCostsNetLongTermDebtxbrl_gz/noc/10k_2025DeferredFinanceCostsNetLongTermDebtxbrl_gz/wday/10k_2026DebtInstrumentUnamortizedDiscountPremiumAndDebtIssuanceCostsNetLongTermDebtNoncurrentNot in this PR
ConvertibleDebt→ShortTermDebt, which is outside the three-entry scope.ReverseIndexand doesn't choose these tags' side by candidate order, so it has no change.AI tool: Claude Code, Claude Opus 5.5.
🤖 Generated with Claude Code